package com.juqimiao.linn.interception.mock;

import com.juqimiao.linn.command.CommandInterceptorI;
import com.juqimiao.linn.interception.PostInterceptor;
import com.juqimiao.linn.interception.PreInterceptor;
import com.juqimiao.linn.logging.Logger;
import com.juqimiao.linn.transfer.Command;
import com.juqimiao.linn.transfer.Response;
import org.springframework.beans.factory.annotation.Autowired;


@PreInterceptor
@PostInterceptor
public class LoggingCommandInterceptor implements CommandInterceptorI<Response, Command> {


    private Logger logger = Logger.getLogger(LoggingCommandInterceptor.class);

    public LoggingCommandInterceptor(){
        System.out.println("ddd");
    }
    @Override
    public void preIntercept(Command command) {
        logger.info(String.format("Command %s, Start executing....", command));
    }

    @Override
    public void postIntercept(Response response, Command command) {
       logger.info(String.format("Command %s, End execution....", command));
    }
}
